<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex complaint_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between complaint_fd0_0'>
					<view class='flex flex-wrap align-center complaint_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  complaint_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='complaint_fd0_0_c1_c0'>我要投诉</text>
					</view>
					<view class='flex align-center justify-end complaint_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout">
				<view class='flex flex-wrap align-center complaint_fd1_0'>
					<text class='complaint_fd1_0_c0'>订单编号</text>
					<benben-input class='flex-sub complaint_fd1_0_c1' type="text" :placeholder="`请选择`"
						confirm-type="done" :maxlength="50" :disabled='true'
						placeholder-style="color:rgba(51, 51, 51, 1);font-size:32rpx" v-model="order_sn" />
					<!-- <image class='complaint_fd1_0_c2' mode="aspectFit" :src='STATIC_URL+"51.png"'></image> -->
				</view>
				<view class='flex flex-wrap align-center complaint_fd1_1'>
				</view>
				<view class='flex flex-wrap align-center complaint_fd1_2'>
					<text class='complaint_fd1_0_c0'>投诉标题</text>
					<benben-input class='flex-sub complaint_fd1_0_c1' type="text" :placeholder="`请输入投诉标题`"
						confirm-type="done" :maxlength="50"
						placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="title" />
				</view>
				<text class='complaint_fd1_3'>投诉内容</text>
				<view class='flex flex-wrap complaint_fd1_4'>
					<textarea class='flex complaint_input_fd1_4' :placeholder="'请填写内容'" :maxlength="240"
						placeholder-style="color:rgba(153, 153, 153, 1);font-size:28rpx" v-model="content" />

				</view>
				<benben-images-upload ref="benbenImagesUploadfd1_5" :img-list.sync="pictureList" :img-ids.sync="picture"
					:maxlength="9">
					<template #content="{ num, maxlength, isShow, imgList }">
						<view class="flex flex-wrap align-start flex complaint_fd1_5">

							<view v-for="(image, index) in imgList" :key="index"
								class='flex position-relative complaint_fd1_50'>
								<text class='fu-iconfont2 position-absolute complaint_fd1_500'
									@tap.stop="$refs.benbenImagesUploadfd1_5.delImage(index)">&#xE8E7;</text>
								<image class='complaint_fd1_501'
									@tap.stop="$refs.benbenImagesUploadfd1_5.previewImage(index)" mode="scaleToFill"
									:src='image'></image>
							</view>
							<image class='complaint_fd1_51' @tap.stop="$refs.benbenImagesUploadfd1_5.manyChooseImage()"
								v-if="isShow" mode="aspectFit"
								:src='STATIC_URL+"87.jpg"'></image>

						</view>
					</template>
				</benben-images-upload>
				<view class='flex flex-wrap align-center complaint_fd1_1'>
				</view>
				<view class='flex flex-wrap align-center complaint_fd1_7'>
					<text class='complaint_fd1_0_c0'>联系人</text>
					<benben-input class='flex-sub complaint_fd1_7_c1' type="text" :placeholder="`联系人姓名`"
						confirm-type="done" :maxlength="12"
						placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="contacts" />
					<benben-select-diy ref="showSelectPopup1698478117895" class-name='flex align-center flex'
						:items.sync="sexType" v-model="sex_id" default-type="value" default-label="name"
						:allow-cancel='false' type="radio" :disabled='false'>
						<template v-for='(item,key0) in sexType'>
							<view v-if="item.isSelected" class='flex align-center flex complaint_fd1_7_c2_c0'
								:key="key0" @tap="$refs.showSelectPopup1698478117895.tapHandle(key0)">
								<image class='complaint_fd1_7_c2_c0_c0' mode="aspectFit" :src='STATIC_URL+"133.png"'>
								</image>
								<text class='complaint_fd1_7_c2_c0_c1'>{{item.name}}</text>
							</view>
							<view v-else class='flex align-center flex complaint_fd1_7_c2_c0' :key="key0"
								@tap="$refs.showSelectPopup1698478117895.tapHandle(key0)">
								<image class='complaint_fd1_7_c2_c0_c0' mode="aspectFit" :src='STATIC_URL+"331.png"'>
								</image>
								<text class='complaint_fd1_7_c2_c0_c1'>{{item.name}}</text>
							</view>
						</template></benben-select-diy>
				</view>
				<view class='flex flex-wrap align-center complaint_fd1_7'>
					<text class='complaint_fd1_0_c0'>联系方式</text>
					<benben-input class='flex-sub complaint_fd1_7_c1' type="number" :placeholder="`联系人手机号`"
						confirm-type="done" :maxlength="11"
						placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="userInfo.phone" />
				</view>
			</view>

			<!---flex布局flex布局结束-->
			<view class="flex flex-wrap align-start justify-center benben-position-layout flex complaint_flex_2">
				<button class='complaint_fd2_0' @tap="postComplaintFunc()">提交</button>

			</view>
			<view :style="{height: '136rpx'}"></view>


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"sexType": [{
					"name": "先生",
					"value": "1",
					"image": ""
				}, {
					"name": "女士",
					"value": "2",
					"image": ""
				}],
				"sex_id": "1",
				"title": "",
				"content": "",
				"picture": "",
				"pictureList": [],
				"contacts": "",
				"aid": "",
				"order_sn": ""
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},
			userInfo: {
				get() {
					return this.$store.state.userInfo
				},
				set() {
					this.$store.commit('updateUserInfo', value)
				},
			},
			/**
			 * @returns 
			 * Android       安卓
			 * IOS       苹果
			 * Web       H5 或 pc
			 * Wechat       微信小程序
			 * Alipay       支付宝小程序
			 * Baidu       百度小程序
			 * ByteBounce       抖音小程序
			 * 360       360小程序
			 * FastApp       快应用
			 */
			appSystemIdentification() {
				return this.$store.state.appSystemIdentification
			}
		},
		watch: {},
		onLoad(options) {
			let {
				aid,
				order_sn
			} = options
			if (aid !== undefined) this.aid = aid
			if (order_sn !== undefined) this.order_sn = order_sn
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//提交投诉
			async postComplaintFunc() {
				if (!validate(this.order_sn, 'require')) {
					this.$message.info('请选择投诉订单');
					return false;
				}
				if (!validate(this.title, 'require')) {
					this.$message.info('请输入投诉标题');
					return false;
				}
				if (!validate(this.content, 'require')) {
					this.$message.info('请输入投诉内容');
					return false;
				}
				if (!validate(this.contacts, 'require')) {
					this.$message.info('请输入联系人');
					return false;
				}
				if (!validate(this.sex_id, 'require')) {
					this.$message.info('请选择性别');
					return false;
				}
				if (!validate(this.userInfo.phone, 'require')) {
					this.$message.info('请输入联系方式');
					return false;
				}
				if (!validate(this.userInfo.phone, 'phone')) {
					this.$message.info('联系方式格式不正确');
					return false;
				}
				//请求方法
				//数据验证

				let data64df4bb4f1fc0 = await this.$api.dbPost(global.apiUrls.post64df4bb4f1fc0, {
					title: this.title,
					content: this.content,
					picture: this.picture,
					contacts: this.contacts,
					sex: this.sex_id,
					contacts_phone: this.userInfo.phone,
					serviceorder_id: this.aid
				});
				if (!data64df4bb4f1fc0) return
				if (data64df4bb4f1fc0.data.code != 1) {
					this.$message.info(data64df4bb4f1fc0.data.msg);
					return
				}



				this.$urouter.navigateTo(`/pages/my/complaintSuccess/complaintSuccess`);
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto;
	}

	.complaint_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.complaint_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
	}

	.complaint_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
		font-weight: 500;
	}

	.complaint_fd0_0_c0 {
		width: 160rpx;
		height: 88rpx;
	}

	.complaint_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
	}

	.complaint_fd1_7_c2_c0_c1 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 40rpx;
	}

	.complaint_fd1_7_c2_c0_c0 {
		width: 34rpx;
		height: 34rpx;
		margin: 0rpx 8rpx 0rpx 0rpx;
	}

	.complaint_fd1_7_c2_c0 {
		margin: 0rpx 0rpx 0rpx 36rpx;
	}

	.complaint_fd1_7_c1 {
		margin: 0rpx 16rpx 0rpx 24rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.complaint_fd1_7 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.complaint_fd1_51 {
		width: 160rpx;
		height: 160rpx;
		margin: 0rpx 7rpx 32rpx 7rpx;
		border-radius: 8rpx;
	}

	.complaint_fd1_501 {
		width: 160rpx;
		height: 160rpx;
		border-radius: 8rpx;
	}

	.complaint_fd1_500 {
		top: 0rpx;
		right: 0rpx;
		z-index: 10;
		color: #ff5536;
	}

	.complaint_fd1_50 {
		margin: 0rpx 7rpx 32rpx 7rpx;
	}

	.complaint_fd1_5 {
		padding: 0rpx 25rpx 0rpx 25rpx;
	}

	.complaint_input_fd1_4 {
		width: 100%;
		height: 234rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		white-space: pre-wrap;
	}

	.complaint_fd1_4 {
		background: rgba(246, 246, 246, 1);
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		padding: 24rpx 24rpx 24rpx 24rpx;
		margin: 0rpx 32rpx 24rpx 32rpx;
	}

	.complaint_fd1_3 {
		margin: 0rpx 32rpx 15rpx 32rpx;
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
		line-height: 45rpx;
	}

	.complaint_fd1_2 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
		margin: 0rpx 32rpx 32rpx 32rpx;
	}

	.complaint_fd1_1 {
		background: rgba(246, 247, 249, 1);
		height: 20rpx;
		background-size: 100% auto;
	}

	.complaint_fd1_0_c2 {
		width: 12rpx;
		height: 24rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.complaint_fd1_0_c1 {
		text-align: right;
		margin: 0rpx 16rpx 0rpx 24rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.complaint_fd1_0_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
		line-height: 45rpx;
	}

	.complaint_fd1_0 {
		margin: 0rpx 32rpx 0rpx 32rpx;
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.complaint_flex_2 {
		width: 750rpx;
		height: 136rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
	}

	.complaint_fd2_0 {
		background: var(--benbenbgColor2);
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		width: 686rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		color: #fff;
		height: 88rpx;
	}
</style>